package com.fantastic.web.ex;

import com.fantastic.common.exception.AlipayException;
import com.fantastic.common.result.ResultData;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author: rxx
 * @since: 2024/6/19 09:36
 * @description:
 */
@RestControllerAdvice
public class AlipayExceptionAdvice {
    /**
     * 支付时异常
     *
     * @return 返回状态对象
     * @ExceptionHandler() 标明controller层只要有方法抛出这个异常就会进入到个方法对异常进行处理
     * @ResponseBody 返回响应体，自动json
     */
    @ExceptionHandler(AlipayException.class)
    public ResultData loginExceptionMethod(AlipayException e) {
        return new ResultData(e.getResponseStatusEnum());
    }

}
